package com.deyuanyun.pic.ctrl.service.impl;

import com.deyuanyun.pic.common.util.AopTargetUtils;
import com.deyuanyun.pic.ctrl.controller.dto.InfluenceVO;
import com.deyuanyun.pic.ctrl.controller.vo.query.OperatorRecordsQueryVO;
import com.deyuanyun.pic.ctrl.mapper.InfluenceMapper;
import com.deyuanyun.pic.ctrl.service.InfluenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ReflectionUtils;

import java.lang.reflect.Method;
import java.util.List;

/**
 * @Description 
 * @author Jerry
 * @date 2017-01-09
 */
@Service
public class InfluenceServiceImpl implements InfluenceService {


    @Autowired InfluenceMapper influenceMapper; //六大干扰源mapper


    private String[] methodStrs = {"queryDcerData", "queryActowData", "queryCpOtherData", "queryDcotherData",
            "queryHtacData", "queryAcerData"};
    @Override
    public List queryInfluenceData(Object obj, int methodIndex) {
        try {
            Object mapper = AopTargetUtils.getTarget(influenceMapper);
            Method method = ReflectionUtils.findMethod(mapper.getClass(), methodStrs[methodIndex], InfluenceVO.class);
            return (List) method.invoke(mapper, obj);
        }  catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
